package com.baor.controller;


import com.baor.domain.SubjectVo;
import com.baor.service.SubjectService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/subject")
public class SubjectController {

    @Autowired
    private SubjectService subjectService;

    @RequestMapping("/list")
    public AjaxResult<?> list(){
        return subjectService.list();
    }

    @RequestMapping("/insert")
    public AjaxResult<?> insert(@RequestBody SubjectVo subjectVo){
        return subjectService.insert(subjectVo);
    }

    @RequestMapping("/delete")
    public AjaxResult<?> delete(@RequestBody List<Integer> list){
        return subjectService.delete(list);
    }

    @RequestMapping("/teachers/{classId}")
    public AjaxResult<?> teachers(@PathVariable Integer classId){
        return subjectService.teachers(classId);
    }

    @RequestMapping("/teachers/insert")
    public AjaxResult<?> teachersInsert(@RequestBody Map<String,Object> map){
        return subjectService.teachersInsert(map);
    }
}
